/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com 

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef RECTANGLE_H_
#define RECTANGLE_H_

#include <iostream>

namespace tri
{

class rectangle
{
    friend std::ostream &operator<<( std::ostream&, const rectangle&);
    
public:
    /**
     * Create a rectangle 
     * 
     * @param left 
     * @param top 
     * @param right 
     * @param bottom
     */
    rectangle(float left=0,float top=0, float right=1.0,float bottom=1.0);
    
    /**
     * Create a rectangle 
     * @param v : {left,top,right,bottom} 
     */
    rectangle(float v[4]);
    
    virtual ~rectangle();
    
    /**
     * Get the contained value
     * 
     * @param v : storage for {left,top,right,bottom} 
     */
    void get(float v[4]);
    
    /**
     * Get an editable refrence to the internal values 
     */
    const float* getValue();
    
    /**
     * Get the corner value of the rectangle
     * 
     * @param v : values are stored {left,top,right,top,left,bottom,right,bottom}
     */
    void getRectValue(float v[8]);
    
    /**
     * Move the rectangle x and y units
     */
    void translate(float x,float y);
    
    /**
     * Get an editable copy of this rectangle
     */
    rectangle copy();
    
    float value[4];
};



}

#endif /*RECTANGLE_H_*/
